{
 "cells": [
  {
   "cell_type": "code",
   "id": "initial_id",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "import torchvision.datasets\n",
    "from torch.utils.data import DataLoader\n",
    "\n",
    "\n",
    "test_data = torchvision.datasets.CIFAR10(root='./dataset', train=False, download=True, transform=torchvision.transforms.ToTensor())\n",
    "test_dataloader = DataLoader(test_data, batch_size=64, shuffle=True, num_workers=0, drop_last=False)\n",
    "\n",
    "img, label = test_dataloader.dataset[0]\n",
    "print(img)\n",
    "print(label)"
   ],
   "outputs": [],
   "execution_count": null
  },
  {
   "metadata": {},
   "cell_type": "code",
   "source": [
    "for data in test_dataloader:\n",
    "    imgs, labels = data\n",
    "    print(imgs.shape)\n",
    "    print(labels)"
   ],
   "id": "5abe9031572fb16a",
   "outputs": [],
   "execution_count": null
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-09-04T02:17:10.246193Z",
     "start_time": "2025-09-04T02:17:06.075259Z"
    }
   },
   "cell_type": "code",
   "source": [
    "from torch.utils.tensorboard import SummaryWriter\n",
    "writer = SummaryWriter(\"./logs\")\n",
    "epoch = 0\n",
    "for data in test_dataloader:\n",
    "    imgs, labels = data\n",
    "    writer.add_images(\"test-data\", imgs, epoch)\n",
    "    epoch = epoch + 1\n",
    "\n",
    "writer.close()\n"
   ],
   "id": "802b342cc5943901",
   "outputs": [],
   "execution_count": 15
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
